$(function(){
	//初始化日历的点击事件
	$("#home_search a").click(function(){
		$("#home_search a.selected").removeClass("selected");
		$(this).addClass("selected");
	});
	//初始化日期格式
	$("#begintime_input_2").val(getNowFormatDate()+" 00:00:00");
	$("#endtime_input_2").val(getNowFormatDate()+" 23:59:59");
})
function KeyDown(key){
	key = (key) ? key : ((window.event) ? window.event : "");  
	var keycode = key.keyCode?key.keyCode:key.which;
	if(!((keycode>=48 && keycode<=57)||(keycode>=96 && keycode<=105)||(keycode==8)||(keycode==32)||(keycode==109)||(keycode==186)||(keycode==189)||(keycode==8)||(keycode==46)||(keycode>=37 && keycode<=40))){
		key.preventDefault();
	}
}
//把日期转化为2016-7-21这种格式
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate    
    return currentdate;
}
//初始化开始和结束时间输入框
function initDatePicker(elementid){
	var id = elementid+"_2";
	WdatePicker({el:id,firstDayOfWeek:1,skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss',position:{left:0,top:5},vel:id});
}
//光标失去焦点校验
function checkDateoth(obj,str){
	var begin_time = $(obj).val();
	var start = checkDate(begin_time);   
	if(!start){
		shows(str,3000);	
	}
}
//移除选中状态
function removeSelected(obj){
	$(obj).removeClass("selected");
}
$(document).ready(function(){
	//去掉点击输入框弹出日历事件
	$(document).click(function(){
	    $('.time_input_2').mousedown(function(){
			$dp.hide();
	    })
		$('.time_input_2').focus(function(){
			$dp.hide();
	    })
	    $('.time_input_2').click(function(){
			$dp.hide();
	    })
	    $(".tooltip").click(function(){
	      	return false;
	    });
	    $dp.hide();
	})
})
